﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Derbster.Domain.Test
{
    [TestClass]
    public class SkaterUnitTest : ContractUnitTest
    {
        [TestMethod]
        public void TestCreateBlank()
        {
            var skater = new Skater();
            Assert.IsNotNull(skater);
        }

        [TestMethod]
        public void TestCreateAndVerify()
        {
            var skater = new Skater("Test Skater", "12AB");
            Assert.IsNotNull(skater);
            Assert.AreEqual("Test Skater", skater.Name);
            Assert.AreEqual("12AB", skater.Number);
        }


        [TestMethod]
        public void TestEquals()
        {
            var newSkater = new Skater();
            Assert.IsTrue(newSkater.Equals(newSkater));
        }
        [TestMethod]
        public void TestCreateBadName()
        {
            bool throws = false;
            try
            {
                var skater = new Skater("  ", "12AB");
            }
            catch (Exception)
            {
                throws = true;
            }
            Assert.IsTrue(throws);
        }

        [TestMethod]
        public void TestCreateBadNumber()
        {
            bool throws = false;
            try
            {
                var skater = new Skater("Test Skater", "-$OKF");
            }
            catch (Exception)
            {
                throws = true;
            }
            Assert.IsTrue(throws);
        }
    }
}
